The on_load directive name is a function which will run automatically whenever a module is loaded. If we use on_load() function then it is not necessary to export the function because when on_load() function will call it will create a newly spawned process (means: it will generate a new process) and the function must return ok if the module is to remain loaded and become callable.It will generate an exception also causes the module to be unloaded. If the return value is not an atom then a warning error report will be sent to the error logger. and until the on_load() function returns ok the system will not terminated. Syntax: -on_load(Function_Name/0).
Liked By
Write Answer
What is the use of on_load() in Erlang programming?
Join MindStick Community
You have need login or register for voting of answers or question.
Tarun Kumar
23-Feb-2016If the return value is not an atom then a warning error report will be sent to the error logger. and until the on_load() function returns ok the system will not terminated.
Syntax:
-on_load(Function_Name/0).